home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / STRXMOV.C < prev    next >
Text File  |  1993-01-04  |  1KB  |  39 lines

  1.  
  2. /*  File   : strxmov.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 25 may 1984
  5.     Defines: strxmov()
  6.  
  7.     strxmov(dst, src1, ..., srcn, NullS)
  8.     moves the concatenation of src1,...,srcn to dst, terminates it
  9.     with a NUL character, and returns a pointer to the terminating NUL.
  10.     It is just like strmov except that it concatenates multiple sources.
  11.     Beware: the last argument should be the null character pointer.
  12.     Take VERY great care not to omit it!  Also be careful to use NullS
  13.     and NOT to use 0, as on some machines 0 is not the same size as a
  14.     character pointer, or not the same bit pattern as NullS.
  15. */
  16.  
  17. #include "strings.h"
  18. #include <varargs.h>
  19.  
  20. /*VARARGS*/
  21. char *strxmov(va_alist)
  22.     va_dcl
  23.     {
  24.         va_list pvar;
  25.         register char *dst, *src;
  26.  
  27.         va_start(pvar);
  28.         dst = va_arg(pvar, char *);
  29.         src = va_arg(pvar, char *);
  30.         while (src != NullS) {
  31.             while (*dst++ = *src++) ;
  32.             dst--;
  33.             src = va_arg(pvar, char *);
  34.         }
  35.         *dst = NUL;     /* there might have been no sources! */
  36.         return dst;
  37.     }
  38.  
  39.